/*
 * Created on 22 août 2005
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package fr.jade.util.log.handler;

import java.util.Iterator;
import java.util.LinkedList;

/**
 * @author ssicard
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class MemoryHandler implements Handler{

	private Handler target;
	private LinkedList logs;
	
	public MemoryHandler(Handler target){
		this.target = target;
		this.logs = new LinkedList();
	}
	
	
	public void log(String msg) {
		logs.addLast(msg);
	}
	
	public void start() {
		//nothing to do
	}
	
	public void stop() {
		Iterator i = logs.iterator();
		while(i.hasNext()){
			target.log((String)i.next());
		}
	}
}
